package com.collegeproject.weatherapp.library;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

import android.annotation.SuppressLint;
import android.text.format.DateUtils;

public class DateClass {

	public DateClass() {
	}

	@SuppressLint("SimpleDateFormat")
	public static String getTimeDifference(String time, String curTime)
			throws ParseException {

		Date curDate;
		Date oldDate;
		SimpleDateFormat formatter = new SimpleDateFormat(
				"MM/dd/yyyy hh:mm:ss aa");
		curDate = (Date) formatter.parse(curTime);
		oldDate = (Date) formatter.parse(time);
		long oldMillis = oldDate.getTime();
		long curMillis = curDate.getTime();

		CharSequence text = DateUtils.getRelativeTimeSpanString(oldMillis,
				curMillis, 0); // DateUtils.FORMAT_ABBREV_ALL
		return text.toString();
	}
}
